
* Replication file for Timothy J. Ryan, "Reconsidering Moral Issues in Politics," JOP 2014.
* Questions, contact TJRyan@umich.edu

* This file produces the quantitative results in the online appendix and paper
* that pertain to the student and student samples. Figures, and results pertaining
* to the ANES sample, are in a separate file.

* Select working directory
cd "/Users/TJRyan/Dropbox/morality/YM/6_replication"

* Select which dataset to use. Comment out the other one.
*use "studentrep.dta", clear
use "mtrep.dta", clear

* SI Section 1
tab female
tab democrat
tab republican
tab educ // MTurk only


* SI Section 3
drop if attention == 0 // Run for MTurk dataset only
corr cbextfold cbimp cbrelev cbsmor
corr ssextfold ssimp ssrelev sssmor
corr gmextfold gmimp gmrelev gmsmor
corr scextfold scimp screlev scsmor
corr afextfold afimp afrelev afsmor


* SI Section 4. Separate versions for student and MTurk datasets. Comment out the one you don't want.

* Version if using student dataset:
/*
quietly factor cbextfold cbimp cbrelev cbsmor1 cbsmor2 cbsmor3
rotate, oblimin oblique blanks(.1)
estat common
quietly: factor ssextfold ssimp ssrelev sssmor1 sssmor2 sssmor3
rotate, oblimin oblique blanks(.1)
estat common
quietly: factor gmextfold gmimp gmrelev gmsmor1 gmsmor2 gmsmor3
rotate, oblimin oblique blanks(.1)
estat common
quietly: factor scextfold scimp screlev scsmor1 scsmor2 scsmor3
rotate, oblimin oblique blanks(.1)
estat common
quietly: factor afextfold afimp afrelev afsmor1 afsmor2 afsmor3
rotate, oblimin oblique blanks(.1)
estat common
*/

* Version if using MTurk dataset:
quietly factor cbextfold cbimp cbrelev cbsmor1 cbsmor2
rotate, oblimin oblique blanks(.1)
estat common
quietly: factor ssextfold ssimp ssrelev sssmor1 sssmor2
rotate, oblimin oblique blanks(.1)
estat common
quietly: factor gmextfold gmimp gmrelev gmsmor1 gmsmor2
rotate, oblimin oblique blanks(.1)
estat common
quietly: factor scextfold scimp screlev scsmor1 scsmor2
rotate, oblimin oblique blanks(.1)
estat common
quietly: factor afextfold afimp afrelev afsmor1 afsmor2
rotate, oblimin oblique blanks(.1)
estat common



* SI Section 5 -- Separate models
* Note that the results in Table 1 of the main paper are a subset of these results.

foreach var in cb ss gm sc af {
	reg `var'warm `var'extfold `var'imp `var'relev `var'smor, robust
	reg `var'cold `var'extfold `var'imp `var'relev `var'smor, robust
	reg `var'angry `var'extfold `var'imp `var'relev `var'smor, robust
	reg `var'disgust `var'extfold `var'imp `var'relev `var'smor, robust
	reg `var'afraid `var'extfold `var'imp `var'relev `var'smor, robust
	reg `var'respect `var'extfold `var'imp `var'relev `var'smor, robust
	reg `var'frust `var'extfold `var'imp `var'relev `var'smor, robust
	reg `var'sad `var'extfold `var'imp `var'relev `var'smor, robust
	reg `var'apprec `var'extfold `var'imp `var'relev `var'smor, robust
	}


* SI Section 5 -- Pooled Models
preserve
#delimit ;
keep random2 female pidr

cbext cbextfold cbimp cbrelev cbsmor cbsmor1
ssext ssextfold ssimp ssrelev sssmor sssmor1
gmext gmextfold gmimp gmrelev gmsmor gmsmor1
scext scextfold scimp screlev scsmor scsmor1
afext afextfold afimp afrelev afsmor afsmor1

cbwarm cbcold cbangry cbdisgust cbafraid cbrespect cbfrust cbsad cbapprec 
sswarm sscold ssangry ssdisgust ssafraid ssrespect ssfrust sssad ssapprec 
gmwarm gmcold gmangry gmdisgust gmafraid gmrespect gmfrust gmsad gmapprec 
scwarm sccold scangry scdisgust scafraid screspect scfrust scsad scapprec 
afwarm afcold afangry afdisgust afafraid afrespect affrust afsad afapprec 

cbcomp sscomp gmcomp sccomp afcomp;

#delimit cr;

*scalar i = 1
foreach iss in cb ss gm sc af {
	foreach dv in extfold imp relev smor warm cold angry disgust afraid respect ///
	frust sad apprec ext comp smor1 {
		rename `iss'`dv' `dv'`iss'
		}
	}

reshape long smor extfold imp comp relev ///
warm cold angry disgust afraid respect frust sad apprec smor1, i(random2) j(cb) string

rename cb issuename
encode issuename, gen(issue)

xtset random2
xtreg warm extfold imp relev smor i.issue, fe robust
xtreg respect extfold imp relev smor i.issue, fe robust 
xtreg apprec extfold imp relev smor i.issue, fe robust 
xtreg cold extfold imp relev smor i.issue, fe robust 
xtreg disgust extfold imp relev smor i.issue, fe robust 
xtreg frust extfold imp relev smor i.issue, fe robust 
xtreg angry extfold imp relev smor i.issue, fe robust 
xtreg sad extfold imp relev smor i.issue, fe robust 
xtreg afraid extfold imp relev smor i.issue, fe robust 
restore

* SI Section 6
* `var'kros is a summary intensity measure that is simply an average of the
* extremity, importance, and relevance measures. Its name is a reference to 
* Jon Krosnick.

foreach var in cb ss gm sc af {
	reg `var'cold `var'kros `var'smor, robust
	reg `var'angry `var'kros `var'smor, robust
	reg `var'disgust `var'kros `var'smor, robust
	reg `var'respect `var'kros `var'smor, robust
	reg `var'apprec `var'kros `var'smor, robust
	}

* Paper Table 2
use "studentrep.dta", clear
reg maniparty moralizer pidstr rcons female, robust
reg maniparty moralizer pidstr rcons female church, robust

use "mtrep.dta", clear
reg maniparty moralizer pidstr rcons age female i.educ, robust
reg maniparty moralizer pidstr rcons age female church i.educ, robust

use "egss.dta", clear
svyset [pw=poststrat]
svy: reg ctherm moralizer pidstr rcons age female i.educ2
svy: reg ctherm moralizer pidstr rcons age female church i.educ2
svy: reg outblame moralizer pidstr rcons age female i.educ2
svy: reg outblame moralizer pidstr rcons age female church i.educ2


* Paper Table 3
use "studentrep.dta", clear
reg partscale moralizer pidstr female church, robust

use "mtrep.dta", clear
reg partscale moralizer pidstr age female i.educ church, robust

use "egss.dta", clear
svyset [pw=poststrat]
svy: reg retpart moralizer pidstr efficacy age female income polknowl i.educ2 church followpol
svy: reg participate moralizer pidstr efficacy age female polknowl income i.educ2 church followpol


